package com.yjq0713.test1_4;

/*习题四
        定义一个点(point)类用来表示三维空间中的点(有三个坐标) 。要求如下：
        1. 可以生成具有特定坐标的点对象
        2. 提供可以设置三个坐标的方法
        3. 提供可以计算该”点”到原点距离平方的方法
        4. 编写程序验证上面三点*/
public class Point {
    private double pointA;
    private double pointB;
    private double pointC;

    public Point(double pointA, double pointB, double pointC) {
        this.pointA = pointA;
        this.pointB = pointB;
        this.pointC = pointC;
    }

    public void setA(double pointA) {
        this.pointA = pointA;
    }

    public void setB(double pointB) {
        this.pointB = pointB;
    }

    public void setC(double pointC) {
        this.pointC = pointC;
    }

    public double squre() {
        return Math.abs(pointA) * Math.abs(pointA) + Math.abs(pointB) * Math.abs(pointB) + Math.abs(pointC) * Math.abs(pointC);
    }

    public static void main(String[] args) {
        Point four = new Point(-1, -2, -3);
        four.setA(20.5);
        System.out.println(four.squre());
    }
}
